﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

namespace SoftwareEngineering_Project
{
    public partial class MyCalendar : System.Web.UI.Page
    {




        protected void Button1_Click(object sender, EventArgs e)
        {
            
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            Reservation myreservation = new Reservation();
            myreservation.SetImportantDates(Calendar1);
            Calendar1.SelectedDayStyle.BackColor = System.Drawing.Color.DarkBlue;
        }

        protected void Calendar1_SelectionChanged(object sender, EventArgs e)
        {
            Reservation myreservation = new Reservation();
            SqlDataReader myreader2 = myreservation.getReservation("select ReservationID as 'ID',Res_Date as'Reservation Date', stime 'Start Time',etime as 'End Time',Reservation.Name as 'Event’s title',Organizer,room.Name as'Location' from reservation,Room Where reservation.Room_ID = Room.Room_ID AND res_date='" + Calendar1.SelectedDate + "'");
            Events.DataSource = myreader2;
            Events.DataBind();
            myreservation.SetImportantDates(Calendar1);
            Calendar1.SelectedDayStyle.BackColor = System.Drawing.Color.DarkBlue;

        }
    }
}
